package com.lkm.app_ui.m.Imple.push.handle;

import android.content.Context;

import com.lkm.app_ui.AppConst;
import com.lkm.app_ui.help.GsonHelp;
import com.lkm.app_ui.m.Imple.steelyard_auto.DeviceinitPo;
import com.lkm.app_ui.m.Imple.steelyard_auto.SteelyardServerModuleAuto;
import com.lkm.market2_0.m.steelyardserver.SteelyardServerModule;
import com.mj.hx.yl.push.PushHandle;

import java.lang.reflect.Type;



public class PushDeviceInitHandle implements PushHandle<DeviceinitPo> {

    @Override
    public Type getDataClass() {
        return DeviceinitPo.class;
    }

    @Override
    public boolean handler(Context context, DeviceinitPo cmd) {

        try {
            SteelyardServerModule steelyardServerModule = AppConst.getModuleManager().peekModule(SteelyardServerModule.class);
            if (steelyardServerModule instanceof SteelyardServerModuleAuto) {
                ((SteelyardServerModuleAuto) steelyardServerModule).upProxy(cmd);
            }
            AppConst.getApplication().getSharedPreferences("settingapp", Context.MODE_PRIVATE).edit().putString("DeviceinitPo", GsonHelp.toJson(cmd)).apply();
        }catch (Exception e){}

        return true;
    }
}
